// Copyright 2009 (c) Tom van Dijck

using System;
using System.Runtime.InteropServices;

namespace Bonehead
{
    public static class RegisterDLL
    {
        private static bool mInitialized = false;

        internal static bool Register()
        {
            if (!mInitialized)
            {
                if (DllRegisterServer() == 0)
                {
                    mInitialized = true;
                }
                else
                {
                    throw new Exception("Couldn't register DotNetProfiler.dll");
                }
            }
            return mInitialized;
        }

        [DllImport("BoneheadRuntime.dll")]
        private static extern int DllRegisterServer();
    }
}
